<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>01 原型继承</title>
</head>

<body>


    <script>
        function Car(name, color) {
            this.name = name;
            this.color = color;
        }
        Car.prototype.price = 100;
        Car.prototype.run = function() {
            console.log('小黑');
        }

        var c1 = new Car('兰博基尼', 'green');
        console.log('c1', c1);
        console.log(c1.price);

        function Father() {
            this.car = '劳斯莱斯';
        }

        function Son() {
            this.phone = '小米Max';
        }
        Son.prototype = new Father(); //通过原型链继承
        var s = new Son();
        console.log('---------:', s.car, s.phone);
    </script>
</body>

</html>